/*
 * SplahsPanel.java
 * Describe SWF
 *
 * A browser for Flash files.
 * Copyright (c) 2001-2006 Flagstone Software Ltd. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation; either version 2 of the License, or (at your option) any later
 * version.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License along with
 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
 * Place, Suite 330, Boston, MA 02111-1307 USA
 * 
 * For more information please contact:
 * 
 * Stuart MacKay
 * Flagstone Software Ltd
 * 92 High Street
 * Wick, Caithness KW1 4LY
 * Scotland
 * 
 * www.flagstonesoftware.com
 */
package com.flagstone.describe;

import java.awt.*;
import javax.swing.*;

final class SplashPanel
{
	private static final long serialVersionUID = 0;
    
    private JWindow window = null;
    
    private int width = 0;
    private int height = 0;
    
    SplashPanel(ImageIcon image)
    {
        width = image.getIconWidth();
        height = image.getIconHeight();
        
        window = new JWindow();
        window.setSize(width, height);
        
     	JLabel imageLabel = new JLabel(image);
        imageLabel.setBounds(0, 0, width, height);
                
        JPanel content = (JPanel)window.getContentPane();
        content.add(imageLabel);
        content.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
    }
    
    void show()
    {
        Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
        
        int x = (screen.width-width)/2;
        int y = (screen.height-height)/2;

        window.setLocation(x, y);
        window.setVisible(true);
        window.toFront();
    }
    void hide()
    {
        window.setVisible(false);
    }
}
